package com.example.gokuplayalong.bases.base;


public class ExceptionHandler {

    public static void saveException(String cml, Exception e) {
        e.printStackTrace();
        try {
//            String errorCode = Tools.getOrderNum();
//            System.out.println("保存errors.log  errorCode : " + errorCode);
//            File f;
//            if (AppParams.getInstance().Platform == "linux") {
//                f = new File(AppParams.getInstance().LinuxHomeDir + "/errors.log");
//            }
//            else {
//                f = new File(AppParams.getInstance().WindowHomeDir + "/errors.log");
//            }
//            if (!f.exists()) {
//                f.createNewFile();
//            }
//            FileWriter fileWriter = new FileWriter(f.getAbsoluteFile(), true);
//            fileWriter.write("errorCode " + errorCode + " start \n\n");
//            fileWriter.write(cml + "\n");
//            fileWriter.write(Tools.getSDF().format(System.currentTimeMillis()) + "\n");
//            fileWriter.write(e.getMessage());
//            fileWriter.write("\n\n");
//            fileWriter.write(" errorCode " + errorCode + " end \n\n");
//
//            fileWriter.close();
        } catch (Exception ex) {

        }

    }

    public static void saveException(String cml, Throwable e) {
        try {
            e.printStackTrace();
//            String errorCode = Tools.getOrderNum();
//            System.out.println("保存errors.log  errorCode : " + errorCode);
//            File f;
//            if (AppParams.getInstance().Platform == "linux") {
//                f = new File(AppParams.getInstance().LinuxHomeDir + "/errors.log");
//            }
//            else {
//                f = new File(AppParams.getInstance().WindowHomeDir + "/errors.log");
//            }
//            if (!f.exists()) {
//                f.createNewFile();
//            }
//            FileWriter fileWriter = new FileWriter(f.getAbsoluteFile(), true);
//            fileWriter.write("errorCode " + errorCode + " start \n\n");
//            fileWriter.write(cml + "\n");
//            fileWriter.write(Tools.getSDF().format(System.currentTimeMillis()) + "\n");
//            fileWriter.write(e.getMessage());
//            fileWriter.write("\n\n");
//            fileWriter.write(" errorCode " + errorCode + " end \n\n");
//
//            fileWriter.close();
        } catch (Exception ex) {

        }


    }
}

